﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CoderJoe.WoW.GearManager.Views
{
	public partial class EquipmentButton 
		: UserControl
	{
		public int EquipmentSlotId { get; set; }

		public CharacterItemModel Model { get; private set; }

		public EquipmentButton()
		{
			InitializeComponent();

            this.gearButton.MouseClick += new MouseEventHandler(gearButton_MouseClick);
            this.gearButton.MouseHover += new EventHandler(gearButton_MouseHover);
            this.gearButton.Click += new EventHandler(gearButton_Click);
            this.gearButton.MouseLeave += new EventHandler(gearButton_MouseLeave);
		}

        void gearButton_MouseLeave(object sender, EventArgs e)
        {
            OnMouseLeave(e);
        }

        void gearButton_Click(object sender, EventArgs e)
        {
            OnClick(e);
        }

        void gearButton_MouseHover(object sender, EventArgs e)
        {
            OnMouseHover(e);
        }

        void gearButton_MouseClick(object sender, MouseEventArgs e)
        {
            OnMouseClick(e);
        }

		internal void SetModel(CharacterItemModel characterItemModel)
		{
			Model = characterItemModel;

			this.gearButton.DataBindings.Add("Image", Model, "Image");
			this.DataBindings.Add("EquipmentSlotId", Model, "SlotIndex");
		}
	}
}
